package com.hadoop.mr2.inputformat;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import com.hadoop.mr2.inputwordcount.WordCountDriver;
import com.hadoop.mr2.inputwordcount.WordCountInputFormat;
import com.hadoop.mr2.inputwordcount.WordCountMapper;

public class ScoreDriver {
	
	public static void main(String[] args) throws Exception {
		Configuration conf=new Configuration();
		Job job=Job.getInstance(conf);
		
		job.setJarByClass(ScoreDriver.class);
		job.setMapperClass(ScoreMapper.class);
		
		job.setMapOutputKeyClass(Text.class);
		job.setMapOutputValueClass(Text.class);
		
		//设置用户自定义的格式输入类，如果不设置，Hadoop默认用的是TextInputFormat类来实现的
		job.setInputFormatClass(ScoreInputFormat.class);
		
		FileInputFormat.setInputPaths(job, new Path("hdfs://192.168.186.6:9000/mr2/input.txt"));
		FileOutputFormat.setOutputPath(job, new Path("hdfs://192.168.186.6:9000/mr2/result"));
		
		job.waitForCompletion(true);
	}

}
